package com.haixiaoke.saas.repository.service.impl;

import com.haixiaoke.saas.repository.mapper.HouseInspectionFacilityMapper;
import com.haixiaoke.saas.repository.mapper.OrderMapper;
import com.haixiaoke.saas.repository.pojo.HouseInspectionFacility;
import com.haixiaoke.saas.repository.service.IHouseInspectionFacilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 验房设施Service业务层处理
 *
 * @author xiaolong
 * @date 2023-04-17
 */
@Service
public class HouseInspectionFacilityServiceImpl implements IHouseInspectionFacilityService {
    @Autowired
    private HouseInspectionFacilityMapper houseInspectionFacilityMapper;
    @Autowired
    private OrderMapper orderMapper;

    /**
     * 查询验房设施
     *
     * @param facilitiesInspectionId 验房设施主键
     * @return 验房设施
     */
    @Override
    public HouseInspectionFacility selectHouseInspectionFacilityByFacilitiesInspectionId(Long facilitiesInspectionId) {
        return houseInspectionFacilityMapper.selectHouseInspectionFacilityByFacilitiesInspectionId(facilitiesInspectionId);
    }

    /**
     * 查询验房设施列表
     *
     * @param houseInspectionFacility 验房设施
     * @return 验房设施
     */
    @Override
    public List<HouseInspectionFacility> selectHouseInspectionFacilityList(HouseInspectionFacility houseInspectionFacility) {
        return houseInspectionFacilityMapper.selectHouseInspectionFacilityList(houseInspectionFacility);
    }

    /**
     * 新增验房设施
     *
     * @param houseInspectionFacility 验房设施
     * @return 结果
     */
    @Override
    public int insertHouseInspectionFacility(HouseInspectionFacility houseInspectionFacility) {

        houseInspectionFacility.setCreateTime(new Date());
        return houseInspectionFacilityMapper.insertHouseInspectionFacility(houseInspectionFacility);
    }

    /**
     * 修改验房设施
     *
     * @param houseInspectionFacility 验房设施
     * @return 结果
     */
    @Override
    public int updateHouseInspectionFacility(HouseInspectionFacility houseInspectionFacility) {
        houseInspectionFacility.setUpdateTime(new Date());
        return houseInspectionFacilityMapper.updateHouseInspectionFacility(houseInspectionFacility);
    }

    /**
     * 批量删除验房设施
     *
     * @param facilitiesInspectionIds 需要删除的验房设施主键
     * @return 结果
     */
    @Override
    public int deleteHouseInspectionFacilityByFacilitiesInspectionIds(Long[] facilitiesInspectionIds) {
        return houseInspectionFacilityMapper.deleteHouseInspectionFacilityByFacilitiesInspectionIds(facilitiesInspectionIds);
    }

    /**
     * 删除验房设施信息
     *
     * @param facilitiesInspectionId 验房设施主键
     * @return 结果
     */
    @Override
    public int deleteHouseInspectionFacilityByFacilitiesInspectionId(Long facilitiesInspectionId) {
        return houseInspectionFacilityMapper.deleteHouseInspectionFacilityByFacilitiesInspectionId(facilitiesInspectionId);
    }

    @Override
    public List<HouseInspectionFacility> selectHouseInspectionFacilityByOrderId(String orderId) {
        return houseInspectionFacilityMapper.selectHouseInspectionFacilityByOrderId(orderId);
    }
}
